package com.tarena.lbs.coupon.pojo.param;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 更新优惠券参数实体类
 * 用于优惠券信息的更新操作
 *
 * @author Feng-hongliang
 * @date 2025/10/14
 */
@Data
public class UpdateCouponParam implements Serializable {
    
    /**
     * 优惠券ID，更新时必填
     */
    @Schema(description = "更新必填")
    private Integer id;

    /**
     * 管理员ID
     */
    @Schema(description = "管理员id")
    private Integer adminId;

    /**
     * 优惠券名称
     */
    @NotEmpty(message = "优惠券名称不能为空")
    @Schema(description = "优惠券名称")
    private String couponName;

    /**
     * 优惠券类型
     */
    @NotNull(message = "优惠券类型不能为空")
    @Schema(description = "优惠券类型")
    private Integer couponType;

    /**
     * 优惠券面额
     */
    @NotNull(message = "优惠券面额不能为空")
    @Schema(description = "优惠券面额")
    private BigDecimal discountValue;

    /**
     * 最大抵扣面额
     */
    @NotNull(message = "最大抵扣面额不能为空")
    @Schema(description = "最大抵扣面额")
    private BigDecimal maxDiscountAmount;

    /**
     * 适用范围
     */
    @NotEmpty(message = "适用范围不能为空")
    @Schema(description = "适用范围")
    private String applicable;

    /**
     * 叠加规则
     */
    @NotNull(message = "叠加规则不能为空")
    @Schema(description = "叠加规则")
    private Integer usageLimit;

    /**
     * 发行量
     */
    @NotNull(message = "发行量不能为空")
    @Schema(description = "发行量")
    private Integer maxUsageLimit;

    /**
     * 开始时间，格式：yyyy-MM-dd 或 yyyy/MM/dd
     */
    @NotEmpty(message = "开始时间不能为空")
    @Pattern(regexp = "^\\d{4}[-/]\\d{1,2}[-/]\\d{1,2}$", message = "开始时间格式不正确，应为yyyy-MM-dd或yyyy/MM/dd格式")
    @Schema(description = "开始时间")
    private String startDate;

    /**
     * 截止时间，格式：yyyy-MM-dd 或 yyyy/MM/dd
     */
    @NotEmpty(message = "截止时间不能为空")
    @Pattern(regexp = "^\\d{4}[-/]\\d{1,2}[-/]\\d{1,2}$", message = "截止时间格式不正确，应为yyyy-MM-dd或yyyy/MM/dd格式")
    @Schema(description = "截止时间")
    private String endDate;

    /**
     * 优惠券描述
     */
    @NotEmpty(message = "优惠券描述不能为空")
    @Schema(description = "优惠券描述")
    private String describes;

    /**
     * 商家ID，前端忽略
     */
    @Schema(description = "商家ID-前端忽略")
    private Integer businessId;

    /**
     * 互斥规则
     */
    @NotNull(message = "互斥规则不能为空")
    @Schema(description = "互斥规则")
    private Integer exclusionType;

    /**
     * 订单满减金额
     */
    @Schema(description = "订单满减")
    private BigDecimal orderAmount;

    /**
     * 每个用户领取数量限制，0表示不限制
     */
    @NotNull(message = "领取数量不能为空，0表示不限制")
    @Schema(description = "领取数量")
    private Integer usageNum;

}